<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    <script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
    <link href="js/layui/css/layui.css" rel="stylesheet"/>

    <link href="css/login.css" rel="stylesheet" type="text/css"/>

</head>
<body>
<h1>后台登录<sup>V2017</sup></h1>

<div class="login" style="margin-top:50px;">

    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">
        <!--登录-->
        <div class="web_login" id="web_login">


            <div class="login-box">


                <div class="login_form">
                    <div class="uinArea" id="uinArea">
                        <label class="input-tips" for="u">帐号：</label>

                        <div class="inputOuter" id="uArea">

                            <input type="text" id="u" name="username" class="inputstyle"/>
                        </div>
                    </div>
                    <div class="pwdArea" id="pwdArea">
                        <label class="input-tips" for="p">密码：</label>

                        <div class="inputOuter" id="pArea">

                            <input type="password" id="p" name="p" class="inputstyle"/>
                        </div>
                    </div>

                    <div style="padding-left:50px;margin-top:20px;">
                        <input type="submit" value="登 录"
                               class="layui-btn" onclick="login()"/>
                    </div>
                </div>

            </div>

        </div>
        <!--登录end-->
    </div>

</div>

</body>
</html>
<script>
    function login() {
        var p = {
            account: $("#u").val(),
            pwd: $("#p").val()
        }
        $.post("/login", p, function (res) {
            if (res.flag) {
                location.href = "/";
            } else {
                alert(res.msg);
            }
        },"json")
    }
</script>